package xpn.platform.modules.todo.donelink;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.rest.webmvc.RepositoryRestController;
import org.springframework.web.bind.annotation.*;
import xpn.platform.common.repository.XpnRepositoryController;

import javax.validation.Valid;

/**
 * 已办事项  Controller
 *
 * @author duwei
 */
@RepositoryRestController
@ResponseBody
@RequestMapping("/done_link")
public class DoneLinkController extends XpnRepositoryController<DoneLink, Long> {

    @Autowired
    DoneLinkService service;

    /**
     * 批量移入待办
     *
     * @paramr request
     */
    @PostMapping("to_todo")
    public void batchToTodo(@Valid @RequestBody String[] ids) {
        service.batchToTodo(ids);
    }

    /**
     * 根据业务Id  已办移入待办
     *
     * @param taskId
     */
    @PostMapping("to_todo/{taskId}")
    public void toTodo(@PathVariable("taskId") String taskId) {
        service.toTodo(taskId);
    }

}
